#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main()
{
    umask(0);
    int fd1 = open("log.txt", O_WRONLY|O_CREAT, 0666);
    int fd2 = open("log1.txt", O_WRONLY|O_CREAT, 0666);  
    int fd3 = open("log2.txt", O_WRONLY|O_CREAT, 0666);  
    int fd4 = open("log3.txt", O_WRONLY|O_CREAT, 0666);  
    if (fd1 < 0)
    {
        perror("open");
        return 1;
    }
    
   // char* str = "aa\n";
  // char buff[64];
  // memset(buff, '\0', sizeof(buff));  //read不会加\0
   // write(fd, str, strlen(str));
  // read(fd, buff ,sizeof(buff));
  // printf("%s\n", buff);
    printf("fd1 = %d\n", fd1);
    printf("fd2 = %d\n", fd2);
    printf("fd3 = %d\n", fd3);
    printf("fd4 = %d\n", fd4); 
    close(fd1);
    close(fd2);
    close(fd3);
    close(fd4);
    return 0;
}

